package top.lywivan.netty.reactor;

import java.util.concurrent.CountDownLatch;

public class ServerShutDownHandler {

    private final CountDownLatch countDownLatch;

    public ServerShutDownHandler(CountDownLatch latch) {
        this.countDownLatch = latch;
    }


    public void handle(Server.State state) {
        if (state == Server.State.ERROR || state == Server.State.SHUTDOWN) {
            countDownLatch.countDown();
        }
    }
}
